package edu.unlv.cs.ladders.entities;

import edu.unlv.cs.ladders.entities.Tournament;
import java.lang.Long;
import java.util.List;

privileged aspect Tournament_Roo_Entity {
    
    public static long Tournament.countTournaments() {
        return (Long) entityManager().createQuery("select count(o) from Tournament o").getSingleResult();
    }
    
    public static List<Tournament> Tournament.findAllTournaments() {
        return entityManager().createQuery("select o from Tournament o").getResultList();
    }
    
    public static Tournament Tournament.findTournament(Long id) {
        if (id == null) return null;
        return entityManager().find(Tournament.class, id);
    }
    
    public static List<Tournament> Tournament.findTournamentEntries(int firstResult, int maxResults) {
        return entityManager().createQuery("select o from Tournament o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
    }
    
}
